home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-04-13 | 1.2 KB | 68 lines | [TEXT/ttxt] |
- -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C)
- -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
- --
- deferred class BENCH
- --
- -- Comparison : ARRAY, FIXED_ARRAY, LINK_LIST and LINK2_LIST.
- --
-
- feature
-
- -- According to the power of your computer, set `tuning'
- -- to a good positive value. Default is for very small
- -- computer :
- tuning: INTEGER is 1; -- 500000;
-
- feature {NONE}
-
- cltn: COLLECTION[INTEGER] is
- deferred
- end;
-
- count: INTEGER is
- do
- Result := 1 + tuning;
- end;
-
- frozen bench is
- require
- cltn.count = count
- do
- increment(cltn,1);
- increment(cltn,1);
- increment(cltn,-2);
- check_all(cltn,0);
- end;
-
- increment(c: like cltn; value: INTEGER) is
- local
- i: INTEGER;
- do
- from
- i := c.upper;
- until
- i = c.lower
- loop
- c.put(c.item(i-1),i);
- i := i - 1;
- end;
- end;
-
- check_all(c: like cltn; value: DOUBLE) is
- local
- i: INTEGER;
- do
- from
- i := c.upper;
- until
- i = c.lower
- loop
- if c.item(i) /= value then
- std_output.put_string("Error in bench.%N");
- end;
- i := i - 1;
- end;
- end;
-
- end
-